﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BibMan.gui {
    public partial class NotesPanel : TabControl {

        private readonly String PinNotesTitle = "Pin";
        private readonly String ReferenceNotesTitle = "Reference";

        private RichTextBox referenceNotesBox;
        public String ReferenceNotes {
            get {
                return referenceNotesBox.Text;
            }
            set {
                referenceNotesBox.Text = value;
            }
        }

        private RichTextBox pinNotesBox;
        public String PinNotes {
            get {
                return pinNotesBox.Text;
            }
            set {
                pinNotesBox.Text = value;
            }
        }

        public NotesPanel() {
            InitializeComponent();

            TabPage referenceNoteTab = new TabPage(ReferenceNotesTitle);
            referenceNotesBox = MakeNotesBox();
            referenceNoteTab.Controls.Add(referenceNotesBox);
            this.TabPages.Add(referenceNoteTab);

            TabPage pinNoteTab = new TabPage(PinNotesTitle);
            pinNotesBox = MakeNotesBox();
            pinNoteTab.Controls.Add(pinNotesBox);
            this.TabPages.Add(pinNoteTab);
        }

        private RichTextBox MakeNotesBox() {
            RichTextBox ret = new RichTextBox();
            ret.Dock = DockStyle.Fill;
            return ret;
        }

        private void TabChanged(object sender, EventArgs e) {
            if (this.SelectedTab.Text.Equals(PinNotesTitle)) {
                this.pinNotesBox.Focus();
            } else if (this.SelectedTab.Text.Equals(ReferenceNotesTitle)) {
                this.referenceNotesBox.Focus();
            }
        }
    }
}
